package com.uwlaser.rest;

import com.uwlaser.annotation.Log;
import com.uwlaser.domain.AntonStatisticsParam;
import com.uwlaser.service.AntonStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangwei
 * @create 2022/12/30
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "安东配置")
@RequestMapping("/api/antonStatistics")
public class AntonStatisticsController {

    @Autowired
    private final AntonStatisticsService antonStatisticsService;

    @GetMapping
    @Log("统计不同安东类型的次数和耗时")
    @ApiOperation("统计不同安东类型的次数和耗时")
    @PreAuthorize("@el.check('antonStatistics:list')")
    public ResponseEntity query(AntonStatisticsParam query, Pageable pageable){
        return new ResponseEntity<> (antonStatisticsService.queryByParam(query,pageable), HttpStatus.OK);
    }
}
